angular.module('mamApp').factory('PlayControlManager', ['$http', 'api', 'paramsManager', function ($http, api, paramsManager) {
    var PlayControlManager = {

        /**
         * 专辑播控列表
         * @param params query
         * @returns
         */

        albumsPlayControlList: function (params, query) {
            return $http.get(api + '/admin/play/manager/albums/' + paramsManager.params(params) + paramsManager.query(query)).then(function (result) {
                return result;
            });
        },
        /**
         * 专辑统一定时上下线
         * @param params query
         * @returns
         */

        albumsPlayOnAndOffAdjust: function (albumIds, params) {
            return $http.put(api + '/admin/play/manager/albums/' + albumIds.join(",") + '/online', params).then(function (result) {
                return result;
            });
        },
        /**
         * 专辑统一调整方案
         * @param params
         * @returns
         */

        adjustAlbumPlayPlan: function (params) {
            return $http.put(api + '/admin/play/planForAlbum', params).then(function (result) {
                return result;
            });
        },
        /**
         * 播控方案的简要列表只有id和name
         * @returns {*|IPromiseLike<TResult>|IPromise<TResult>|IThenjsProto}
         */

        albumPlanSimpleList: function () {
            return $http.get(api + '/admin/play/plan/idAndNames').then(function (result) {
                return result;
            });
        },
        /**
         * 播控方案列表
         * @returns {*|IPromiseLike<TResult>|IPromise<TResult>|IThenjsProto}
         */

        albumPlanList: function (params) {
            return $http.get(api + '/admin/play/plans/' + paramsManager.params(params)).then(function (result) {
                return result;
            });
        },
        /**
         * 播控方案添加
         * @returns {*|IPromiseLike<TResult>|IPromise<TResult>|IThenjsProto}
         */

        albumPlanAdd: function (params) {
            return $http.post(api + '/admin/play/plan', params).then(function (result) {
                return result;
            });
        },
        /**
         * 播控方案修改
         * @returns {*|IPromiseLike<TResult>|IPromise<TResult>|IThenjsProto}
         */

        albumPlanEdit: function (params) {
            return $http.put(api + '/admin/play/plan', params).then(function (result) {
                return result;
            });
        },
        /**
         * 播控方案详情
         * @returns {*|IPromiseLike<TResult>|IPromise<TResult>|IThenjsProto}
         */

        albumPlanDetail: function (id) {
            return $http.get(api + '/admin/play/plan/'+id).then(function (result) {
                return result;
            });
        },
        /**
         * 播控方案删除
         * @returns {*|IPromiseLike<TResult>|IPromise<TResult>|IThenjsProto}
         */

        albumPlanDelete: function (id) {
            return $http.delete(api + '/admin/play/plan/' + id).then(function (result) {
                return result;
            });
        },
        /**
         * 播控方案下面的专辑
         * @returns
         */

        albumListByPlanId: function (planId,params,query) {
            return $http.get(api + '/admin/play/'+planId+'/albums/'+paramsManager.params(params)+paramsManager.query(query)).then(function (result) {
                return result;
            });
        },
        /**
         *  渠道的详细列表，新建方案使用
         * @returns
         */

        albumChannels: function () {
            return $http.get(api + '/admin/play/channel').then(function (result) {
                return result;
            });
        },
        /**
         * 播控渠道列表
         * @returns {*|IPromiseLike<TResult>|IPromise<TResult>|IThenjsProto}
         */
        playChannelList: function (params,query) {
            return $http.get(api+'/admin/play/channel/list/'+paramsManager.params(params)+paramsManager.query(query)).then(function (result) {
                return result;
            });
        },
        /**
         * 播控渠道添加
         * params
         * @returns
         */

        playChannelAdd: function (params) {
            return $http.post(api + '/admin/play/channel/',params).then(function (result) {
                return result;
            });
        },
        /**
         * 播控渠道编辑
         * params
         * @returns
         */

        playChannelEdit: function (id,params) {
            return $http.put(api + '/admin/play/channel/'+id,params).then(function (result) {
                return result;
            });
        },
        /**
         * 播控渠道删除
         * params
         * @returns
         */

        playChannelDel: function (channelId) {
            return $http.delete(api + '	/admin/play/channel/'+channelId).then(function (result) {
                return result;
            });
        } ,
        /**
         * 获取系统时间
         * params
         * @returns
         */

        serverDate: function () {
            return $http.get(api+'/admin/common/serverDate').then(function (result) {
                return result;
            });
        },
        playPlatformlList:function () {
            return $http.get(api+'/admin/play/channel/clientTypeList').then(function (result) {
                return result;
            });
        }


    };


    return PlayControlManager;
}]);

